import React from 'react';

export default class Child extends React.Component {
    constructor(props) {
        super(props);
        this.state = {count: 0}
    }

    componentWillMount() {
        console.log('will mount');
    }

    componentDidMount() {
        console.log('did mount');
    }

    componentWillReceiveProps(newProps) {
        console.log('will props' + newProps.name);
    }

    shouldComponentUpdate() {
        console.log('should update' + this.props.name);
        return true;
    }

    componentWillUpdate() {
        console.log('will update' + this.props.name);
    }

    componentDidUpdate() {
        console.log('did update' + this.props.name);
    }

    render() {
        return <div>
            <p>这里是子组件</p>
            <p>{this.props.name}</p>
        </div>
    }
}
